ARG LATEST_IMAGE
FROM ${LATEST_IMAGE} as cache

FROM centos:7

# Install the necessary packages for building the python modules.
# Some of these are dependencies of the specific modules, and could
# instead be added to the wheels.cfg file in the future.
ADD http://mirrors.huaweicloud.com/repository/conf/CentOS-AltArch-7.repo /etc/yum.repos.d/CentOS-Base.repo

RUN set -ex ;\
    sed -i '/\[main\]/ atimeout=120' /etc/yum.conf ;\
    yum install -y epel-release centos-release-openstack-train ;\
    yum install -y git gcc zip bzip2 unzip gcc-c++ \
                   python python-devel python-pip python-wheel \
                   wget openldap-devel mariadb mariadb-devel \
                   libvirt libvirt-devel liberasurecode-devel nss-devel \
                   systemd-devel postgresql-devel ;\
    pip install --upgrade pip setuptools

# For crush
# RUN yum install -y cmake boost-devel libatomic_ops-devel
RUN yum install -y libffi-devel
COPY docker-build-wheel.sh /
COPY wheels.cfg /wheels.cfg
COPY --from=cache /wheels /wheels
RUN chmod a+x /docker-build-wheel.sh && /docker-build-wheel.sh